# -*- coding: utf-8 -*-
import random


class Sprite:
    def __init__(self, name, blood_volume, ggress_ivity):
        self.name = name
        self.blood_volume = blood_volume
        self.ggress_ivity = ggress_ivity

    def attack(self, name):
        self.ggress_ivity = random.randrange(self.ggress_ivity - 5, self.ggress_ivity + 5)
        if name.is_living():
            name.blood_volume -= self.ggress_ivity

    def is_living(self):
        if self.blood_volume > 0:
            return True
        return False


class Hero(Sprite):
    pass


class Monster(Sprite):
    pass


if __name__ == '__main__':

    monster = Monster('风暴龙王', 100, 20)
    hero = Hero('凯', 100, 30)
    print('决战风暴龙王开始')
    while True:
        print('{}对{}造成伤害：{}'.format(monster.name, hero.name, monster.ggress_ivity))
        monster.attack(hero)
        if monster.is_living() and hero.is_living():
            print('{}对{}造成伤害：{}'.format(hero.name, monster.name, hero.ggress_ivity))
            hero.attack(monster)
        else:
            break
    if monster.is_living():

        print('{}死了,{}赢了。'.format(hero.name, monster.name))
    elif hero.is_living():
        print('{}死了,{}赢了。'.format(monster.name, hero.name))
    else:
        print('{}和{}都死了。'.format(monster.name, hero.name))
